package com.ruoyi.system.fallbackFactory;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.db.domain.system.dto.SysJob;
import com.ruoyi.system.fallbackFactory.impl.RemoteJobFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * app服务
 * 
 * @author ruoyi
 */
@FeignClient(contextId = "remoteJobService", value = ServiceNameConstants.JOB_SERVICE, fallbackFactory = RemoteJobFallbackFactory.class)
public interface RemoteJobService
{
    /**
     * 新增定时任务
     * @param job
     * @param source
     * @return
     */
    @PostMapping("/job")
    public R<AjaxResult> add(@RequestBody SysJob job, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 修改定时任务
     * @param job
     * @param source
     * @return
     */
    @PutMapping("/job")
    public R<AjaxResult> edit(@RequestBody SysJob job, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 删除定时任务
     * @param jobIds
     * @return
     */
    @DeleteMapping("/job/{jobIds}")
    public R<AjaxResult> remove(@PathVariable("jobIds") Long[] jobIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
